package com.hystrix.command;

import com.alibaba.fastjson.JSONObject;
import com.hystrix.http.HttpPost;
import com.hystrix.model.InfoA;
import com.hystrix.util.Constant;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

/**
 * 泛型为最终返回的数据结果
 * 
 * @author wangxh
 *
 */
public class ServiceAInfoCommand extends HystrixCommand<InfoA> {

	public ServiceAInfoCommand() {
		super(HystrixCommandGroupKey.Factory.asKey("GetServiceAInfoCommand"));
	}

	@Override
	protected InfoA run() throws Exception {
		String a = HttpPost.httpPost(Constant.serviceA, "", "utf-8");
		return JSONObject.parseObject(a, InfoA.class);
	}

}
